package by.grsu.hdm.model.remotecontrol;

import by.grsu.hdm.exception.IllegalInternalStateException;
import by.grsu.hdm.model.IDevice;
import by.grsu.hdm.model.ihomedevice.HomeDeviceStatus;
import by.grsu.hdm.model.ihomedevice.IHomeDevice;

public abstract class AbstractRemoteControl {
	
	private IDevice device;
	
	public HomeDeviceStatus turnOn(){
		if(device instanceof IHomeDevice)
			try {
				return ((IHomeDevice)device).turnOn();
			} catch (IllegalInternalStateException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		else return null;
		return null;
	}

	public HomeDeviceStatus turnOff() {
		if(device instanceof IHomeDevice)
			return ((IHomeDevice)device).turnOff();
		else return null;
	}
	
	public String getDeviceId() {
		return device.getDeviceId();
	}
	
}
